package hubol;

import owg.util.Calc;

public class Shake extends Entity{
	public double spd;
	public double z = 0;
	
	public final static double DEFAULT = .075;

	public Shake() {
		this(DEFAULT);
	}
	
	public Shake(double s) {
		super(0, 0, 3);
		spd = s;
		alarm[0] = 1 + (int)Calc.random(35);
		alarm[1] = 1 + (int)Calc.random(35);
		alarm[2] = 1 + (int)Calc.random(35);
	}
	
	public static Shake[] shake(int amount, double shake){
		Shake[] out = new Shake[amount];
		for (int i = 0; i<amount; i++)
			out[i] = new Shake(shake);
		return out;
	}
	
	public static Shake[] shake(int amount){
		return shake(amount, DEFAULT);
	}
	
	public void alarmEvent(int i){
		if (i == 0)
			x = Calc.approach(x, 0, 2.5);
		else if (i == 1)
			y = Calc.approach(y, 0, 2.5);
		else
			z = Calc.approach(z, 0, 2.5);
		alarm[i] = 1 + (int)Calc.random(35);
	}
	
	public void step(){
		x += Calc.rangedRandom(spd);
		y += Calc.rangedRandom(spd);
		z += Calc.rangedRandom(spd);
		alarmStep();
	}
	
	public void render(){
		//void
	}

}
